<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="gutianyang">
		<title>消费折扣管理</title>
		<script language="javascript" src="../script/common.js" type="text/javascript"></script>
		<script language="javascript" src="../script/core/mootools.js" type="text/javascript"></script>
		<script language="javascript" src="../script/rule/rulemgnt.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
			//全局变量
			
			RuleMgnt.ruleType = RuleType.DISCOUNT_PURCHASE
			RuleMgnt.editPage = "/basic/purchase_discount_edit.html"
			
			RuleMgnt.mgntLower = true;
			
			RuleMgnt.mainJudgeSearch = "<label>卡片类别</label> <select name=mainJudge ><option></option></select>"
			var cardTypes = function(){
				var result = DWR.syncCall("zhgjService.findCardTypes");
				var items = [];
				for (var i=0;i<result.length;i++){
					var r = result[i];
					var item = {}
					item.code = r.id;
					item.text = r.name;
					items.push(item)
				}
				return items
			}()
			RuleMgnt.mainJudgeSearchFunc = function(form){
				Common.initDict(form.mainJudge,cardTypes,"全 部");
			}
			
			RuleMgnt.mainJudgeEdit = RuleMgnt.mainJudgeSearch
			RuleMgnt.mainJudgeEditFunc = function(form){
				Common.initDict(form.mainJudge,cardTypes);
			}
			
			
			RuleMgnt.defResultEdit = "<label>折&nbsp;扣&nbsp;率</label> "
							+ "<input type=text name=discountRate maxlength=20 onblur=\"checkV(this,'int')\"/> %"
					
			RuleMgnt.beforeSave = function(){
				var form = RuleMgnt.getEditForm()
            	if (!checkForm(form)) return -1;
				
				var result = {discountRate:form.discountRate.value}
				if (!result.discountRate )
				{
					showInformation("需要输入缺省执行结果")
					return -1
				}
				result.discountRate = (new Number(result.discountRate * 1.0)/100).round(2);
				return result
			}
			
			RuleMgnt.beforeEdit = function(ruletSet){
				if (ruletSet.defResult){
					var form = RuleMgnt.getEditForm()
					var defR = ruletSet.defResult
					if (defR.discountRate){
						form.discountRate.value = defR.discountRate * 100
					} 
				}
			}
					
			//页面加载方法
			function load(){
				Eui.showNavigation();
			
		 		RuleMgnt.createViews('content',"mgnt")
		 		
			}
			
			
		</script>
	</head>
	<body onload="load()">
		<!--页面导航-->
		<div class="nav"><div id="nav">&nbsp;</div></div>

		<div id="content"></div>
		
		
							
	</body>
</html>